package com.rykj.qxj.server.services.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.rykj.qxj.server.dao.ApiResponseParamMapper;
import com.rykj.qxj.server.model.entity.ApiResponseParam;
import com.rykj.qxj.server.services.IApiResponseParamService;

@Service
public class ApiResponseParamServiceImpl implements IApiResponseParamService{
	
	@Autowired
	private ApiResponseParamMapper apiResponseParamMapper;
	
	public String saveResponseParamAndGeneSql(List<ApiResponseParam> responseParamList,String joinStr,String requestStr,String responseStr) {
		apiResponseParamMapper.insertList(responseParamList);
		StringBuffer sb=new StringBuffer();
		sb.append("SELECT").append(" ").append(responseStr)
		.append(" ").append("from").append(" ").append(joinStr)
		.append(" ").append("where").append(" ").append(requestStr);
		return sb.toString();
	}
	public void deleteResponseParam(Integer id) {
		apiResponseParamMapper.delete(apiResponseParamMapper.selectByPrimaryKey(id));
	}
	
	public List<ApiResponseParam> selectApiResponseParamListByApiVersionId(Integer apiVersionId){
		return apiResponseParamMapper.selectApiResponseParamListByApiVersionId(apiVersionId);
		
	}
}
